<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>




<body>
<div class="pull-left">
    <div class="form-group form-inline">
        总共${page.pages} 页，共${page.total} 条数据。
        <select class="form-control" id="select" onchange="setSize($('#select option:selected') .val())">
            <option ${pageContext.session.getAttribute("size") eq 1 ? "selected" : ""} value="${1}">1</option>
            <option ${pageContext.session.getAttribute("size") eq 2 ? "selected" : ""} value="${2}">2</option>
            <option ${pageContext.session.getAttribute("size") eq 3 ? "selected" : ""} value="${3}">3</option>
            <option ${pageContext.session.getAttribute("size") eq 4 ? "selected" : ""} value="${4}">4</option>
            <option ${pageContext.session.getAttribute("size") eq 5 ? "selected" : ""} value="${5}">5</option>
        </select>
    </div>
</div>

<div class="box-tools pull-right">
    <ul class="pagination" style="margin: 0px;">

        <li >
            <a href="javascript:goPage(1)" aria-label="Previous">首页</a>
        </li>


        <li><a href="javascript:goPage(${page.prePage})">上一页</a></li>


        <c:forEach begin="${page.navigateFirstPage}" end="${page.navigateLastPage}" var="i">
            <li class="paginate_button ${page.pageNum==i ? 'active':''}">
                <a href="javascript:goPage(${i})">${i}</a>
            </li>
        </c:forEach>


        <li><a href="javascript:goPage(${page.nextPage})">下一页</a></li>


        <li>
            <a href="javascript:goPage(${page.pages})" aria-label="Next">尾页</a>
        </li>
    </ul>
</div>
<form id="pageForm" action="${param.pageUrl}" method="post">
    <input type="hidden" name="page" id="pageNum">
    <input type="hidden" name="size" id="size">
</form>
<script>

    function setSize(size) {
        document.getElementById("size").value = size
        document.getElementById("pageForm").submit()
    }
    function goPage(page) {
        document.getElementById("pageNum").value = page
        document.getElementById("pageForm").submit()
    }
</script>
</body>
</html>
